package org.example.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 视图
 */
@Controller
public class ViewController {
    @RequestMapping("/thymeleaf")
    public String testThymeleaf() {
        // 由配置的Thymeleaf视图解析器解析成Thymeleaf视图，然后通过转发访问
        return "success";
    }

    @RequestMapping("/testForward")
    public String testForward() {
        // 转发视图
        return "forward:/thymeleaf";
    }

    @RequestMapping("/testRedirect")
    public String testRedirect() {
        // 重定向视图
        return "redirect:/thymeleaf";
    }
}
